package com.hnx.admin.aurora.system.controller;

import com.hnx.admin.aurora.annotation.LoginLog;
import com.hnx.admin.aurora.system.domain.param.user.query.LoginQuery;
import com.hnx.admin.aurora.system.service.UserService;
import com.hnx.admin.aurora.web.json.ResultJson;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/*
创建人： 倔强的头发
创建时间：2025/6/15
功能描述: 登录控制器

*/
@RestController
@RequiredArgsConstructor
public class SysLoginController {
    private final UserService userService;
    @LoginLog
    @PostMapping("/login")
    public ResultJson login(@RequestBody @Valid LoginQuery loginBody)
    {
        return userService.login(loginBody);
    }
    /**
     * 获取用户信息
     *
     * @return 用户信息
     */
    @GetMapping("getInfo")
    public ResultJson getInfo()
    {
        return userService.getInfo();
    }
    /**
     * 获取路由信息
     *
     * @return 路由信息
     */
    @GetMapping("getRouters")
    public ResultJson getRouters()
    {
        return userService.getRouters();
    }
}
